//
//  NetHome.m
//  CarCare
//
//  Created by ileo on 14-8-19.
//  Copyright (c) 2014年 baozun. All rights reserved.
//

#import "NetHome.h"
#import "CalendarMgr.h"
#import "AIUserInfo.h"

@implementation NetHome

+(NetHome *)getNoticeWithHeadID:(NSInteger)headID orEndID:(NSInteger)endID{
    return [__SELF request:@"/Notice/getnotice" withParams:@{@"head_id":@(headID),@"end_id":@(endID)} type:REQUEST_POST];
}

+(NetHome *)getMoneyDetailWithLastDate:(NSString *)lastDate{
    if ([lastDate isNotNil]) {
        lastDate = [NSString stringWithFormat:@"%@-01",lastDate];
    }else{
        lastDate = @"";
    }
    return [__SELF request:@"/epoint/getEPbyMonth" withParams:@{@"month":lastDate} type:REQUEST_POST];
}

+(NetHome *)getMoneyInfo{
    return [__SELF request:@"/epoint/getEPcount" withParams:nil type:REQUEST_POST];
}

+(NetHome *)getRewardDetail{
    return [__SELF request:@"/epoint/getReward" withParams:nil type:REQUEST_POST];
}

+(NetHome *)getCalendarInfoWithDate:(NSString *)date{
    return [__SELF request:@"/travels/getCalendar2" withParams:@{@"calendar":date,@"imei":USERINFO.pastDevice} type:REQUEST_POST];
}

+(NetHome *)exchangeAliPayWithNum:(NSInteger)num{
    //cashflag  number
    return [__SELF request:@"/epoint/exchangeJFB" withParams:@{@"number":@(num),@"cashflag":@(1)} type:REQUEST_POST];
}

+(NetHome *)getShakeMoneyWithInfoID:(NSString *)infoID{
    return [__SELF request:@"/epoint/eprock" withParams:@{@"info_id":infoID} type:REQUEST_POST];
}

+(NetHome *)rewardNew{
    return [__SELF request:@"/epoint/getRewardCount" withParams:nil type:REQUEST_POST];
}

+(NetHome *)feedBackWithMessage:(NSString *)message{
    return [__SELF request:@"/feedback/commit" withParams:@{@"info":message} type:REQUEST_POST];
}

+(NetHome *)getSummaryInfoWithType:(NSInteger)type time:(NSString *)time{
    return [__SELF request:@"/report/getReport" withParams:@{@"flag":@(type),@"time":time,@"imei":USERINFO.pastDevice} type:REQUEST_POST];
}

#pragma mark -
-(NSDictionary *)requestCommonParams{
    if (![USERINFO.session isNotNil]) {
        return nil;
    }
    return @{@"tel":USERINFO.tel,@"userid":@(USERINFO.userID), @"date":[CALENDARMGR currentDay],@"session":USERINFO.session};
}

@end
